<template>
  <div class="audit">
    <!--tab-->
    <van-tabs v-model="active" swipeable color="#1989fa">
      <van-tab title="备案处置" name="1"></van-tab>
      <van-tab title="核查工具" name="2"></van-tab>
    </van-tabs>
    <!--tab-->
    <!--备案处置-->
    <div v-show="active == '1'">
      <div class="czInfo">
        <div>备案信息</div>
      </div>
      <van-form>
        <van-field
          autosize
          readonly
          input-align="right"
          label="驾驶员姓名"
          v-model="formData.driver_name"
        />
        <van-field
          autosize
          readonly
          input-align="right"
          label="驾驶员身份证号"
          v-model="formData.driver_cardno"
        />
        <van-field
          autosize
          readonly
          input-align="right"
          label="驾驶员手机号码"
          v-model="formData.driver_tel"
        />
        <div class="field">
          <div class="label">是否途经风险地区</div>
          <div class="text">
            <div
              :class="{ 'icon': formData.quguo_high_risk == '1', 'icon1': formData.quguo_high_risk == '2' }"
            ></div>
            <div
              :class="{ 'value': formData.quguo_high_risk == '1', 'value1': formData.quguo_high_risk == '2' }"
            >{{ formData.quguo_high_risk == '1' ? '未途经' : formData.quguo_high_risk == '2' ? '途经' : formData.quguo_high_risk == '3' ? '未查询到行程记录' : '' }}</div>
          </div>
        </div>
        <van-field
          autosize
          readonly
          input-align="right"
          label="最新核酸检测结果"
          v-model="formData.hesuan_result1"
        />
        <!--<van-field autosize readonly input-align="right"-->
        <!--           label="车辆类别"-->
        <!--           v-model="formData.cheliang_type_name"-->
        <!--/>-->
        <van-field
          autosize
          readonly
          input-align="right"
          label="车牌号码"
          v-model="formData.car_number"
        />
        <van-field
          autosize
          readonly
          input-align="right"
          label="车牌颜色"
          v-model="formData.chepai_color_name"
        />
        <!--<van-field autosize readonly input-align="right"-->
        <!--           label="车体颜色"-->
        <!--           v-model="formData.car_color"-->
        <!--/>-->
        <van-field autosize readonly input-align="right" label="运输证号" v-model="formData.dlys_no" />
        <!--<van-field v-if="isInAndOuts == 2 || isInAndOuts == 3"  input-align="right" name="radio" label="冷链车辆">-->
        <!--  <template #input>-->
        <!--    <van-radio-group v-model="formData.car_is_ll" direction="horizontal" disabled>-->
        <!--      <van-radio name="1" readonly>是</van-radio>-->
        <!--      <van-radio name="2" readonly>否</van-radio>-->
        <!--    </van-radio-group>-->
        <!--  </template>-->
        <!--</van-field>-->
        <van-field
          autosize
          readonly
          input-align="right"
          label="从业证号"
          v-model="formData.people_cy_no"
        />
        <van-field
          v-if="isInAndOuts == 2"
          autosize
          readonly
          input-align="right"
          label="来返沈时间"
          v-model="formData.arrive_time"
        />
        <van-field
          v-if="isInAndOuts == 1"
          autosize
          readonly
          input-align="right"
          label="离沈时间"
          v-model="formData.arrive_time"
        />
        <van-field
          v-if="isInAndOuts == 2"
          autosize
          readonly
          input-align="right"
          label="来返沈住址"
          v-model="formData.arrive_address"
        />
        <van-field autosize readonly input-align="right" label="在沈时间" v-model="formData.zssj_name" />
        <van-field v-if="isInAndOuts == 1" autosize readonly input-align="right" label="目的地" v-model="formData.origin" />
        <van-field v-if="isInAndOuts == 2" autosize readonly input-align="right" label="出发地" v-model="formData.origin" />
        <van-field v-if="isInAndOuts == 2" autosize readonly input-align="right" label="途经地" v-model="formData.tjd" />
        <van-field
          v-if="isInAndOuts == 2"
          input-align="right"
          label="到沈区域"
          readonly
          name="pattern"
          v-model="formData.dsqName"
        />
        <div v-if="isInAndOuts == 2 || isInAndOuts == 3">
          <div class="czInfo">
            <div>货物信息</div>
          </div>
          <div v-for="(item, index) in formData.goodsList" :key="index">
            <!-- 入沈是卸货  出沈是装货-->
            <van-field
              input-align="right"
              v-if="isInAndOuts != 1"
              :label="'装货地点' + (index + 1)"
              readonly
              name="pattern"
              placeholder="装货地点"
              :value="formData.goodsList[index].goods_pretend ? formData.goodsList[index].goods_pretend_s + ',' + formData.goodsList[index].goods_pretend : ''"
            />
            <van-field
              input-align="right"
              v-if="isInAndOuts != 3"
              :label="'卸货区' + (index + 1)"
              readonly
              name="pattern"
              placeholder="请选择卸货区"
              v-model="formData.goodsList[index].ascription_code_name"
            />
            <!-- <van-field input-align="right"
            v-if="isInAndOuts != 3"
            :label="'物品名称'+(index+1)"
            v-model="formData.goodsList[index].goods_name"
            name="pattern"
            placeholder="请输入物品名称"
            />-->
            <!-- <van-field input-align="right"
            v-if="isInAndOuts != 3"
              :label="'物品卸货时间'+(index+1)"
              @focus="checkoutTimeChange(index)"
              readonly
              v-model="formData.goodsList[index].goods_discharge_time"
              name="pattern"
              placeholder="请输入物品卸货时间"
            />-->
            <van-field
              input-align="right"
              v-if="isInAndOuts != 3"
              readonly
              :label="'卸货地点' + (index + 1)"
              v-model="formData.goodsList[index].goods_discharge"
              name="pattern"
            />
            <van-field
              input-align="right"
              v-if="isInAndOuts != 3"
              readonly
              :label="'收货单位' + (index + 1)"
              v-model="formData.goodsList[index].receiving_dw"
              name="pattern"
            />
            <van-field
              input-align="right"
              v-if="isInAndOuts != 3"
              readonly
              :label="'收货人姓名' + (index + 1)"
              v-model="formData.goodsList[index].receiving_name"
              name="pattern"
              placeholder="请输入收货人姓名"
            />
            <van-field
              input-align="right"
              v-if="isInAndOuts != 3"
              readonly
              :label="'收货人手机号码' + (index + 1)"
              v-model="formData.goodsList[index].receiving_tel"
              name="pattern"
              placeholder="请输入收货人手机号码"
            />
          </div>
        </div>
        <div class="czInfo">
          <div>同行信息</div>
        </div>
        <div v-for="(item, index) in formData.peerList" :key="index + 'p'">
          <van-field
            autosize
            readonly
            input-align="right"
            :label="'同行人姓名' + (index + 1)"
            v-model="formData.peerList[index].passenger_name"
          />
          <van-field
            autosize
            readonly
            input-align="right"
            :label="'同行人身份证号' + (index + 1)"
            v-model="formData.peerList[index].passenger_cardno"
          />
          <van-field
            autosize
            readonly
            input-align="right"
            :label="'同行人手机号码' + (index + 1)"
            v-model="formData.peerList[index].passenger_tel"
          />
          <div class="field">
            <div class="label">是否途经风险地区</div>
            <div class="text">
              <div
                :class="{ 'icon': formData.peerList[index].quguo_high_risk == '1', 'icon1': formData.peerList[index].quguo_high_risk == '2' }"
              ></div>
              <div
                :class="{ 'value': formData.peerList[index].quguo_high_risk == '1', 'value1': formData.peerList[index].quguo_high_risk == '2' }"
              >{{ formData.peerList[index].quguo_high_risk == '1' ? '未途经' : formData.peerList[index].quguo_high_risk == '2' ? '途经' : formData.peerList[index].quguo_high_risk == '3' ? '未查询到行程记录' : '' }}</div>
            </div>
          </div>
          <!--<van-field autosize readonly input-align="right"-->
          <!--           label="是否去过高风险地区"-->
          <!--           v-model="formData.peerList[index].quguo_high_risk"-->
          <!--/>-->
          <van-field
            autosize
            readonly
            input-align="right"
            label="最新核酸检测结果"
            v-model="formData.peerList[index].hesuan_result1"
          />
          <van-button
            type="primary"
            :disabled="formData.peerList[index].checkBtnTxt == '比对成功'"
            @click="checkBtn(index)"
            block
          >{{ formData.peerList[index].checkBtnTxt }}</van-button>
        </div>
        <!--<div v-if="formData.car_is_ll == '1'">-->
        <!--  <div class='czInfo'>-->
        <!--    <div>清单信息</div>-->
        <!--  </div>-->
        <!--  <div class="title">进出口清单</div>-->
        <!--  <div class="img_list">-->
        <!--    <div @click="preview(item)" v-for="item in formData.coldchainList[0].jck_qd" :key="item"><img :src="item" alt=""></div>-->
        <!--  </div>-->
        <!--  <div class="title">进出口检疫检验证明</div>-->
        <!--  <div class="img_list">-->
        <!--    <div @click="preview(item)" v-for="item in formData.coldchainList[0].jck_jyzm" :key="item"><img :src="item" alt=""></div>-->
        <!--  </div>-->
        <!--  <div class="title">核酸检测证明</div>-->
        <!--  <div class="img_list">-->
        <!--    <div @click="preview(item)" v-for="item in formData.coldchainList[0].hs_zm" :key="item"><img :src="item" alt=""></div>-->
        <!--  </div>-->
        <!--  <div class="title">消杀证明</div>-->
        <!--  <div class="img_list">-->
        <!--    <div @click="preview(item)" v-for="item in formData.coldchainList[0].xs_zm" :key="item"><img :src="item" alt=""></div>-->
        <!--  </div>-->
        <!--</div>-->
      </van-form>
      <!---->
      <div class="czInfo">
        <div>相关处置</div>
      </div>
      <van-field
        v-if="isInAndOuts == 2 || isInAndOuts == 3"
        input-align="right"
        name="radio"
        label="现场核酸采样"
      >
        <template #input>
          <van-radio-group v-model="resultsData.hscy" direction="horizontal">
            <van-radio name="1">是</van-radio>
            <van-radio name="2">否</van-radio>
          </van-radio-group>
        </template>
      </van-field>
      <van-field
        v-if="isInAndOuts == 2 || isInAndOuts == 3"
        input-align="right"
        name="radio"
        label="体温状况"
      >
        <template #input>
          <van-radio-group v-model="resultsData.temperature" direction="horizontal">
            <van-radio name="1">体温正常</van-radio>
            <van-radio name="2">体温异常</van-radio>
          </van-radio-group>
        </template>
      </van-field>
      <van-field
        v-if="isInAndOuts == 2 || isInAndOuts == 3"
        input-align="right"
        name="radio"
        label="现场货物检验"
      >
        <template #input>
          <van-radio-group v-model="resultsData.type" direction="horizontal">
            <van-radio name="1">冷链</van-radio>
            <van-radio name="2">非冷链</van-radio>
          </van-radio-group>
        </template>
      </van-field>
      <!--<van-field v-if="isInAndOuts == 2 || isInAndOuts == 3" input-align="right" name="radio" label="健康证明">-->
      <!--  <template #input>-->
      <!--    <van-radio-group v-model="resultsData.worker_jkzm" direction="horizontal">-->
      <!--      <van-radio name="1" >有</van-radio>-->
      <!--      <van-radio name="2" >无</van-radio>-->
      <!--    </van-radio-group>-->
      <!--  </template>-->
      <!--</van-field>-->
      <div class="trip">
        <van-field name="radio" label="管控处置情况">
          <template #input>
            <van-radio-group v-model="radio" direction="horizontal">
              <van-radio name="1">放行</van-radio>
              <!-- <van-radio name="2">劝返</van-radio> -->
              <van-radio name="3">隔离</van-radio>
            </van-radio-group>
          </template>
        </van-field>
      </div>
      <van-field
        v-if="radio == '2'"
        v-model="message"
        rows="2"
        autosize
        label="劝返原因"
        type="textarea"
        maxlength="50"
        placeholder="请输入劝返原因"
        show-word-limit
      />
      <!-- <van-field v-if="radio == '3'" name="radio" label="隔离方式"> -->
      <!-- <template #input> -->
      <!-- <van-radio-group v-model="isolation" direction="horizontal"> -->
      <!--      <van-radio name="0">居家隔离</van-radio>-->
      <!--      <van-radio name="1">集中隔离</van-radio>-->
      <!--    </van-radio-group>-->
      <!--  </template>-->
      <!--</van-field>-->
      <!--<div v-if="radio == '3' && isolation == '0'">-->
      <!--  <div>-->
      <!--    <van-field input-align="right"-->
      <!--               label="家属姓名"-->
      <!--               v-model="resultsData.familyMembers"-->
      <!--               name="pattern"-->
      <!--               placeholder="请输入家属姓名"-->
      <!--               :rules="[{ required: true }]"-->
      <!--    />-->
      <!--    <van-field input-align="right"-->
      <!--               label="家属电话"-->
      <!--               v-model="resultsData.familyMembersPhone"-->
      <!--               name="pattern"-->
      <!--               placeholder="请输入家属电话"-->
      <!--               :rules="[{ pattern,required: true }]"-->
      <!--    />-->
      <!--  </div>-->
      <!--</div>-->
      <!--<div v-if="radio == '3' && isolation == '1'">-->
      <!--  <div class='concentrated'>-->
      <!--    <van-field name="radio" label="集中隔离原因">-->
      <!--      <template #input>-->
      <!--        <van-radio-group v-model="resultsData.concentratedType" direction="horizontal" >-->
      <!--          <van-radio name="0">重点管控区</van-radio>-->
      <!--          <van-radio name="1">无法居家检测</van-radio>-->
      <!--        </van-radio-group>-->
      <!--      </template>-->
      <!--    </van-field>-->
      <!--    <van-field input-align="right"-->
      <!--               label="送达体温"-->
      <!--               v-model="resultsData.concentratedTw"-->
      <!--               name="pattern"-->
      <!--               placeholder="请输入送达体温"-->
      <!--               :rules="[{ required: true }]">-->
      <!--      <template #right-icon>-->
      <!--        ℃-->
      <!--      </template>-->
      <!--    </van-field>-->
      <!--  </div>-->
      <!--</div>-->
      <!--提交-->
      <van-button type="primary" block @click="submit" style="margin-top: 1rem;">确认提交</van-button>
      <!--提交-->
    </div>
    <!--备案处置-->

    <!-- 小工具 -->
    <div v-show="active == '2'">
      <div class="nucleicAcid">
        <div class="title">查询48小时核酸</div>
        <van-field
          input-align="right"
          label="姓名"
          v-model="resultsData.name"
          name="pattern"
          placeholder="请输入姓名"
          :rules="[{ required: true }]"
        />
        <div class="trip">
          <van-field
            input-align="right"
            label="身份证号"
            v-model="resultsData.card"
            name="pattern"
            placeholder="请输入身份证号"
            :rules="[{ required: true }]"
          >
            <template #button>
              <van-button size="small" type="primary" @click="getHsJcJg">查询</van-button>
            </template>
          </van-field>
        </div>
        <van-field
          input-align="right"
          label="最新核酸检测结果"
          v-model="results.hesuan_result1"
          name="pattern"
          readonly
          placeholder="最新核酸检测结果"
        />
      </div>
      <div class="nucleicAcid">
        <div class="title">查询风险地区</div>
        <van-field
          input-align="right"
          label="手机号码"
          v-model="resultsData.phone"
          name="pattern"
          placeholder="手机号码"
          :rules="[{ pattern, required: true }]"
        >
          <template #button>
            <van-button
              size="small"
              type="primary"
              native-type="button"
              @click="getPhoneCode(resultsData.phone)"
            >发送验证码</van-button>
          </template>
        </van-field>
        <van-field
          input-align="right"
          label="输入验证码"
          v-model="resultsData.verificationCode"
          name="pattern"
          maxlength="6"
          placeholder="请输入验证码"
          :rules="[{ required: true }]"
        >
          <template #button>
            <van-button size="small" type="primary" native-type="button" @click="getRisk">查询</van-button>
          </template>
        </van-field>
        <div class="field">
          <div class="label" style="margin-left: .8rem">是否途经风险地区</div>
          <div class="text" style="margin-right: .8rem">
            <div
              :class="{ 'icon': xcData.quguo_high_risk == '1', 'icon1': xcData.quguo_high_risk == '2' }"
            ></div>
            <div
              :class="{ 'value': xcData.quguo_high_risk == '1', 'value1': xcData.quguo_high_risk == '2' }"
            >{{ xcData.quguo_high_risk == '1' ? '未途经' : xcData.quguo_high_risk == '2' ? '途经' : xcData.quguo_high_risk == '3' ? '未查询到行程记录' : '' }}</div>
          </div>
        </div>
      </div>
      <div class="nucleicAcid">
        <div class="title">查询行程轨迹</div>
        <van-field
          input-align="right"
          label="车牌号码"
          v-model="trip.vehicleNo"
          name="pattern"
          readonly
          @click="keyState = true"
          placeholder="请输入车牌号码"
        />
        <van-field
          input-align="right"
          readonly
          clickable
          label="车牌颜色"
          :value="projectNameValue2.lable"
          placeholder="请选择车牌颜色"
          @click="showPicker_t = true"
        />
        <van-field
          input-align="right"
          readonly
          label="开始时间"
          :value="trip.start"
          placeholder="请选择开始时间"
          @click="goIntime = true"
        />
        <van-field
          input-align="right"
          readonly
          label="结束时间"
          :value="trip.end"
          placeholder="请选择结束时间"
          @click="goIntime1 = true"
        />
        <van-button type="primary" @click="track" class="btnClass">查询</van-button>
      </div>
    </div>
    <!-- 小工具 -->
    <van-popup v-model="showCategory" round position="bottom">
      <van-picker
        title="请选择体温状况"
        show-toolbar
        :columns="categoryArr"
        value-key="lable"
        @cancel="showCategory = false"
        @confirm="categoryConfirm"
      />
    </van-popup>
    <van-popup v-model="showCategory1" round position="bottom">
      <van-picker
        title="请选择货物类型"
        show-toolbar
        :columns="categoryArr1"
        value-key="lable"
        @cancel="showCategory1 = false"
        @confirm="categoryConfirm1"
      />
    </van-popup>
    <van-popup v-model="showPicker_t" round position="bottom">
      <van-picker
        title="请选择车辆车牌颜色"
        show-toolbar
        :columns="projectListArr"
        value-key="lable"
        @cancel="showPicker_t = false"
        @confirm="changeConfirm"
      />
    </van-popup>
    <keyword
      :isShow="keyState"
      @exit="confirm"
      @inputchange="getKey"
      :oinp="trip.vehicleNo"
      @ok="confirm"
    />
    <van-popup v-model="goIntime" round position="bottom">
      <van-datetime-picker
        @confirm="getConfirm1"
        @cancel="goIntime = false"
        v-model="currentDate"
        type="datehour"
        :min-date="minDate1"
      />
    </van-popup>
    <van-popup v-model="goIntime1" round position="bottom">
      <van-datetime-picker
        @confirm="getConfirm2"
        @cancel="goIntime1 = false"
        v-model="currentDate1"
        type="datehour"
        :min-date="minDate2"
      />
    </van-popup>
    <van-popup v-model="showMap" round closeable>
      <div class="mapOut" v-if="showMap">
        <div class="title">行程轨迹</div>
        <VueBaiduMap
          :vehicleNo="trip.vehicleNo"
          :vehicleColor="trip.vehicleColor"
          :start="trip.start"
          :end="trip.end"
        />
      </div>
    </van-popup>
  </div>
</template>

<script>
import { Toast, ImagePreview } from 'vant'
import {
  getCargoTransportationInfoAc,
  getCompanyInfo,
  t_getHsJcJg,
  t_getHs_siji_tongxing,
  updateWorkerSh,
  getCode,
  judgeWarning,
  distinguishSstErCode,
  getQyBaInfo
} from '../../api/gov/home/index'
import { areaList } from '@vant/area-data'
import keyword from '../../components/keyword'
import VueBaiduMap from '@/components/Map'
import moment from 'moment'
export default {
  components: {
    keyword,
    VueBaiduMap
  },
  props: {},
  data () {
    return {
      active: '1',
      areaList,
      pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/,
      isInAndOuts: null, // 1.出沈 2.入沈 3.返沈
      keyState: false,
      showPicker_t: false,
      goIntime: false,
      goIntime1: false,
      showMap: false,
      currentDate: new Date(),
      currentDate1: new Date(),
      minDate1: new Date(1990, 1, 1),
      minDate2: new Date(1990, 1, 1),
      message: '',
      radio: '1',
      isolation: '', // 勾选隔离
      formData: {
        peerList: [
          {
            passenger_name: '张三',
            passenger_cardno: '211422199711257613',
            passenger_tel: '12520437366',
            quguo_high_risk: '1',
            checkBtnTxt: '身份核验'
          }
        ]
      },
      resultsData: {
        name: '', // 查询核酸时填写姓名
        card: '', // 查询核酸时填写身份证号
        phone: '', // 查询行程时手机号
        verificationCode: '', // 查询行程时验证码
        hscy: '1', // 核酸采样
        temperature: '1', // 体温
        type: '1', // 冷链 非冷链
        worker_jkzm: '1', // 健康证明

        familyMembers: '', // 居家隔离家属姓名
        familyMembersPhone: '', // 居家隔离家属电话

        concentratedType: '0', // 集中隔离原因
        concentratedTw: '' // 集中隔离体温
      },
      results: {
        hesuan_result1: '', // 结果
        hesuan_result: '', // 结果
        hesuan_detail: '' // 详情
      }, // 获取到的核酸检测结果
      xcData: {
        quguo_high_risk: ''
      }, // 风险地区结果
      trip: { // 车辆行程轨迹
        vehicleNo: '', // 车牌号
        vehicleColor: '', // 车牌颜色
        start: '', // 开始时间
        start1: '', // 开始时间
        end: '', // 结束时间
        end1: '' // 结束时间
      },
      projectNameValue: '',
      projectNameValue1: '',
      projectNameValue2: '',
      showCategory: false,
      showCategory1: false,
      categoryArr: [
        {
          value: '1',
          lable: '体温正常'
        },
        {
          value: '2',
          lable: '体温异常'
        }
      ],
      categoryArr1: [
        {
          value: '1',
          lable: '冷链'
        },
        {
          value: '2',
          lable: '非冷链'
        }
      ],
      categoryArr3: [ // 车两类别
        {
          value: '1',
          lable: '小型轿车'
        },
        {
          value: '2',
          lable: '客运车辆'
        },
        {
          value: '3',
          lable: '货车'
        },
        {
          value: '4',
          lable: '特种车辆'
        }
      ],
      projectListArr: [
        {
          value: '1',
          lable: '蓝色'
        },
        {
          value: '2',
          lable: '黄色'
        },
        {
          value: '3',
          lable: '黑色'
        },
        {
          value: '4',
          lable: '白色'
        },
        {
          value: '5',
          lable: '绿色'
        },
        {
          value: '9',
          lable: '其他'
        }
      ],
      leaveTimeArr: [
        {
          value: '1',
          lable: '当天离沈'
        },
        {
          value: '2',
          lable: '在沈过夜'
        },
        {
          value: '3',
          lable: '空车返沈'
        }
      ],
      columns: [
        {
          'code': 'LM00001',
          'name': '和平区'
        },
        {
          'code': 'LM00002',
          'name': '沈河区'
        },
        {
          'code': 'LM00003',
          'name': '大东区'
        },
        {
          'code': 'LM00004',
          'name': '皇姑区'
        },
        {
          'code': 'LM00005',
          'name': '铁西区'
        },
        {
          'code': 'LM00006',
          'name': '浑南区'
        },
        {
          'code': 'LM00007',
          'name': '于洪区'
        },
        {
          'code': 'LM00008',
          'name': '沈北新区'
        },
        {
          'code': 'LM00009',
          'name': '苏家屯区'
        },
        {
          'code': 'LM00010',
          'name': '辽中区'
        },
        {
          'code': 'LM00011',
          'name': '康平县'
        },
        {
          'code': 'LM00012',
          'name': '法库县'
        },
        {
          'code': 'LM00013',
          'name': '新民市'
        }
      ]
    }
  },
  mounted () {
    this.isInAndOuts = this.$route.query.value
    console.log(this.areaList, '地区')
    console.log('this.$route.query.value', this.$route.query.value)
    Toast.loading({
      message: '加载中...',
      forbidClick: true,
      duration: 10000
    })
    getCargoTransportationInfoAc({ driver_cardno: this.$route.query.cardNo, arrive_type_one: this.$route.query.value }).then(res => {
      console.log('t1', res)
      if (res.data.errcode != 0) {
        Toast.fail(res.data.errmsg)
        const TIME = setTimeout(() => {
          this.$router.go(-1)
          clearTimeout(TIME)
        }, 1500)
      }
      try {
        var tbox = {
          siji_info: {},
          tongxing_info_list: {}
        }
        if (res.data.data.driver_name) {
          tbox.siji_info.name = res.data.data.driver_name
        }
        if (res.data.data.driver_cardno) {
          tbox.siji_info.card_no = res.data.data.driver_cardno
        }
        if (res.data.data.peerList && res.data.data.peerList.length > 0) {
          var t_arr = []
          for (var i = 0; i < res.data.data.peerList.length; i++) {
            var t_obj = {}
            if (res.data.data.peerList[i].passenger_name) {
              t_obj.name = res.data.data.peerList[i].passenger_name
            }
            if (res.data.data.peerList[i].passenger_name) {
              t_obj.card_no = res.data.data.peerList[i].passenger_cardno
            }
            t_arr.push(t_obj)
          }
        }
        t_getHs_siji_tongxing(tbox).then(res => {
          console.log('tbox', res)
        })
      } catch (err) {
        console.error(err)
      }

      const fr = ['jck_qd', 'jck_jyzm', 'hs_zm', 'xs_zm']
      fr.forEach(i => {
        if (res.data.data.coldchainList[0][i].indexOf(',') === -1) {
          res.data.data.coldchainList[0][i] = [res.data.data.coldchainList[0][i]]
        } else {
          res.data.data.coldchainList[0][i] = res.data.data.coldchainList[0][i].split(',')
        }
      })
      // 车辆类别
      if (res.data.data.cheliang_type) {
        res.data.data.cheliang_type_name = this.categoryArr3.find(e => e.value == res.data.data.cheliang_type).lable // 车辆类别
      }
      if (res.data.data.chepai_color) {
        res.data.data.chepai_color_name = this.projectListArr.find(e => e.value == res.data.data.chepai_color).lable // 车牌颜色
      }
      if (res.data.data.zssj) {
        res.data.data.zssj_name = this.leaveTimeArr.find(e => e.value == res.data.data.zssj).lable // 在沈时间
      }
      if (res.data.data.dsq) {
        res.data.data.dsqName = this.columns.find(e => e.code == res.data.data.dsq).name // 到沈区域
      }
      if (res.data.data.hesuan_result && res.data.data.hesuan_detail) {
        res.data.data.hesuan_result1 = res.data.data.hesuan_result + '(' + res.data.data.hesuan_detail + ')'
      } else {
        res.data.data.hesuan_result1 = '国家核酸检测接口请求失败'
      }
      res.data.data.origin = ''
      for (let i in this.areaList.province_list) {
        if (res.data.data.cfd_s == i) {
          res.data.data.origin = this.areaList.province_list[i]
        }
      }
      for (let i in this.areaList.city_list) {
        if (res.data.data.cfd_city == i) {
          res.data.data.origin = res.data.data.origin + ',' + this.areaList.city_list[i]
        }
      }
      res.data.data.peerList.map((v) => {
        v.checkBtnTxt = '核验身份'
        if (v.hesuan_result && v.hesuan_detail) {
          v.hesuan_result1 = v.hesuan_result + '(' + v.hesuan_detail + ')'
        } else {
          v.hesuan_result1 = '国家核酸检测接口请求失败'
        }
        return v
      })
      res.data.data.goodsList.map((v) => {
        if (v.ascription_code) {
          v.ascription_code_name = this.columns.find(e => e.code == v.ascription_code).name
        }
      })
      this.formData = res.data.data

      this.trip.vehicleNo = res.data.data.car_number
      this.trip.vehicleColor = res.data.data.chepai_color
      this.projectNameValue2 = { lable: res.data.data.chepai_color_name }

      // 用车牌号查询是入沈还是返沈
      if (this.isInAndOuts != 1) { // 不是出沈时候 判断
        getCompanyInfo({ car_number: res.data.data.car_number }).then(req => {
          console.log(req, '车牌号改变 判断是否是返沈 入沈')
          // 1.出沈 2.入沈 3.返沈
          this.isInAndOuts = req.data.data.id ? 3 : 2
          console.log(this.isInAndOuts)
        })
      }
      Toast.clear()
    })
  },
  computed: {},
  methods: {
    categoryConfirm (val, index) {
      this.projectNameValue = val // 传值
      // this.formData.car_category = val.value
      this.showCategory = false
      console.log(index)
    },
    categoryConfirm1 (val, index) {
      this.projectNameValue1 = val // 传值
      // this.formData.car_category = val.value
      this.showCategory1 = false
      console.log(index)
    },
    preview (img) {
      ImagePreview([img])
    },
    // 获取核酸检测结果
    getHsJcJg () {
      console.log(this.resultsData.name, '名')
      console.log(this.resultsData.card, '证号')
      if (!this.resultsData.name || !this.resultsData.card) {
        return false
      }
      // 获取核酸检测结果
      t_getHsJcJg({ name: this.resultsData.name, card_no: this.resultsData.card }).then(ret => {
        if (ret.data.errcode == 0) {
          const data = JSON.parse(ret.data.data.data)
          const prs = JSON.parse(data.data)
          if (prs.data != '') {
            this.results.hesuan_result = prs.data.hsjcjg
            this.results.hesuan_detail = prs.data.hsjcsj
            this.results.hesuan_result1 = prs.data.hsjcjg + '(' + prs.data.hsjcsj + ')'
          } else {
            this.$dialog.alert({
              message: '未查询到核酸结果'
            })
            this.results.hesuan_result1 = '未查询到核酸结果'
          }
        } else {
          this.results.hesuan_result1 = '国家核酸检测接口请求失败'
        }
      })
    },
    // 获取验证码
    getPhoneCode (phone) {
      if (!phone) { Toast.success('请填写手机号'); return }
      getCode({ phone }).then((res) => {
        if (res.data.errcode == 0) {
          const toa = res.data.data.data.result == null ? res.data.data.data.errorDesc : res.data.data.data.result
          Toast.success(toa)
        }
      })
    },
    // 拿去途经地结果
    getRisk () {
      const obj = {
        phone: this.resultsData.phone,
        verification: this.resultsData.verificationCode
      }
      if (!obj.phone) {
        Toast.success('请填写手机号')
        return
      }
      if (!obj.verification) {
        Toast.success('请填写验证码')
        return
      }
      judgeWarning(obj).then((res) => {
        if (res.data.errcode == 0) {
          this.xcData.quguo_high_risk = res.data.data.data.result.value
        }
      })
    },
    confirm (e) {
      this.keyState = false
      // if (this.formData.car_number.length >= 5 && this.isInAndOuts != 1) {
      //   // 车牌号改变 判断是否是返沈 入沈
      //   console.log(this.formData.car_number)
      //   getCompanyInfo({ car_number: this.formData.car_number }).then(res => {
      //     console.log(res, '车牌号改变 判断是否是返沈 入沈')
      //     console.log(JSON.parse(JSON.stringify(this.isInAndOuts)))
      //     // 1.出沈 2.入沈 3.返沈
      //     this.isInAndOuts = res.data.data.id ? 3 : 2
      //     console.log(this.isInAndOuts)
      //   })
      // }
    },
    getKey (val) {
      if (this.trip.vehicleNo.length >= 8 && val != 'delete') {
        return false
      }
      if (val == 'delete') {
        this.trip.vehicleNo = this.trip.vehicleNo.slice(0, this.trip.vehicleNo.length - 1)
      } else {
        this.trip.vehicleNo += val
      }
    },
    // 车牌颜色
    changeConfirm (val, index) {
      this.projectNameValue2 = val // 传值
      this.trip.vehicleColor = val.value
      this.showPicker_t = false
      console.log(index) // 索引
    },
    getConfirm1 (value) {
      this.trip.start = moment(value).format('YYYY-MM-DD HH:00:00')
      this.goIntime = false
    },
    getConfirm2 (value) {
      this.trip.end = moment(value).format('YYYY-MM-DD HH:00:00')
      this.goIntime1 = false
    },
    // 查询车辆形成轨迹 地图
    track () {
      if (!this.trip.vehicleNo || !this.trip.vehicleColor || !this.trip.start || !this.trip.end) {
        this.$dialog.alert({
          message: '填写信息不全'
        })
        return false
      }
      this.showMap = true
      // this.trip.start1 = moment(this.trip.start).format('YYYY-MM-DD 00:00:00')
      // this.trip.end1 = moment(this.trip.end).format('YYYY-MM-DD 23:59:59')
    },
    // 同行人 身份核验
    checkBtn (index) {
      const name = this.formData.peerList[index].passenger_name // 姓名
      const cardNo = this.formData.peerList[index].passenger_cardno // 身份证号
      this.$hdsdk.scanQrCode().then(res => {
        if (!!res && res.code == 0 && !!res.data && !!res.data.scanResult) {
          distinguishSstErCode({ ecQrCode: res.data.scanResult }).then(ret => {
            console.log(ret, '获取用户信息')
            if (cardNo == ret.data.data.data.cardNo && name == ret.data.data.data.userName) {
              this.formData.peerList[index].checkBtnTxt = '比对成功'
              this.formData.peerList[index].infoType = false
              Toast.success('核验成功')
            } else {
              this.formData.peerList[index].infoType = true
              Toast.success('与备案信息不符')
            }
          })
        }
      })
    },
    async submit () {
      const obj = {
        car_number: this.formData.car_number,
        driver_cardno: this.formData.driver_cardno,
        arrive_time: this.formData.arrive_time
      }
      const data = await getQyBaInfo(obj)
      if (data.data.errcode == 0) {
        this.$dialog.confirm({
          message: '已匹配到收货人信息',
          showConfirmButton: true,
          showCancelButton: true,
          cancelButtonText: '返回'
        }).then(() => {
          // on confirm
          this.nextTo()
        }).catch(() => { })
      } else {
        this.$dialog.confirm({
          message: '未匹配到收货人备案信息',
          showConfirmButton: false,
          showCancelButton: true,
          cancelButtonText: '返回'
        }).then(() => {
          this.nextTo()
        }).catch(() => { })
      }
    },
    nextTo () {
      Toast.loading({
        message: '加载中...',
        forbidClick: true,
        duration: 10000
      })
      if (this.resultsData.hscy == '' || this.resultsData.hscy == null) {
        this.$dialog.alert({
          message: `请选择现场核酸采样`
        })
        return
      }
      if (this.resultsData.temperature == '' || this.resultsData.temperature == null) {
        this.$dialog.alert({
          message: `请选择体温状况`
        })
        return
      }
      if (this.radio == '' || this.radio == null) {
        this.$dialog.alert({
          message: `请选择管控处置情况`
        })
        return
      }
      const infoType = this.formData.peerList.find(e => e.infoType)
      if (infoType && infoType.infoType) {
        this.$dialog.alert({
          message: `同行人(${infoType.passenger_name})未注册盛事通,请同行人员注册盛事通后再进行提交`
        })
        return
      }
      updateWorkerSh({
        type: this.radio,
        reason: this.message,
        arrive_type_one: this.$route.query.value,
        register_code: this.formData.register_code,
        worker_jkzm: this.resultsData.worker_jkzm, // 健康证明
        worker_czfs: this.radio, // 处置方式
        worker_reason: this.message, // 劝返原因
        worker_glfs: this.isolation, // 隔离方式
        worker_jsxm: this.resultsData.familyMembers, // 家属姓名
        worker_jsdh: this.resultsData.familyMembersPhone, // 家属姓名
        worker_jzglyy: this.resultsData.concentratedType, // 集中隔离原因
        worker_tw: this.resultsData.concentratedTw, // 送达体温
        worker_hs_name: this.resultsData.name, // 姓名 核酸
        worker_hs_cardno: this.resultsData.card, // 身份证号 核酸
        worker_hs_result: this.results.hesuan_result, // 核酸结果
        worker_hs_detail: this.results.hesuan_detail, // 核酸结果详情
        worker_xc: this.xcData.quguo_high_risk, // 行程结果
        worker_xchs: this.resultsData.hscy, // 现场核酸
        worker_xctw: this.resultsData.temperature, // 现场体温
        worker_xchwjy: this.resultsData.type // 现场验货
      }).then(res => {
        console.log(res)
        Toast.clear()
        if (res.data.errcode == 0) {
          Toast.success('审核成功')
          const TIME = setTimeout(() => {
            this.$router.go(-1)
            clearTimeout(TIME)
          }, 1500)
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
.audit {
  .title {
    padding: 0.533rem 0.853rem;
    font-size: 0.747rem;
    color: #646566;
  }
  /deep/.van-field__label {
    width: 9em;
    display: flex;
    align-items: center;
  }
  .img_list {
    margin: 20px 0.853rem;
    display: flex;
    img {
      width: 120px;
      height: 120px;
      margin-right: 20px;
    }
  }
}
.czInfo {
  height: 80px;
  font-size: 32px;
  //font-weight: bold;
  //color: white;
  //background-color: #58be6a;
  background-color: #eee;
  display: flex;
  align-items: center;
  div {
    width: 690px;
    margin: 0 auto;
  }
}
.nucleicAcid {
  width: 690px;
  margin: 40px auto;
  border-radius: 20px;
  overflow: hidden;
  box-sizing: border-box;
  //border: 1px solid #DDEEE3;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  .title {
    text-align: center;
    font-size: 28px;
    color: white;
    background-color: #58be6a;
  }
}
.btn {
  width: 150px;
}
.field {
  width: 690px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ebedf0;
  margin: 0 auto;
  box-sizing: border-box;
  .label {
    font-size: 28px;
    color: #646566;
    flex-shrink: 0;
  }
  .text {
    font-size: 28px;
    color: #646566;
    display: flex;
    align-items: center;
    .icon {
      width: 15px;
      height: 15px;
      border-radius: 15px;
      background-color: #58be6a;
      flex-shrink: 0;
      margin-right: 5px;
    }
    .icon1 {
      width: 15px;
      height: 15px;
      border-radius: 15px;
      flex-shrink: 0;
      background-color: red;
      margin-right: 5px;
    }
    .value {
      color: #58be6a;
    }
    .value1 {
      color: red;
    }
  }
}
.concentrated /deep/.van-field__label {
  width: 6.3em;
}
//.concentrated /deep/ .van-radio--horizontal{
//  margin-top: 10px;
//  margin-left: 160px;
//}
.btnClass {
  width: 95%;
  margin: 20px 18px;
}
.mapOut {
  width: 690px;
  height: 1000px;
  background-color: white;
  .title {
    height: 60px;
    line-height: 60px;
    font-size: 32px;
    text-align: center;
  }
}
.trip /deep/.van-field__label {
  width: 8em;
}
</style>
